package com.mdd.admin.controller.setting;

import com.mdd.admin.service.setting.IRechargeConfigService;
import com.mdd.admin.validate.setting.RechargeConfigValidate;
import com.mdd.common.core.AjaxResult;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/api/recharge/config")
public class RechargeConfigController {

    @Resource
    private IRechargeConfigService iRechargeConfigService;

    @GetMapping("/getConfig")
    public AjaxResult getConfig(){
        Map<String, Object> config = iRechargeConfigService.getConfig();
        return AjaxResult.success(config);
    }

    @PostMapping("/setConfig")
    public AjaxResult setConfig(@RequestBody RechargeConfigValidate rechargeConfigValidate){
        iRechargeConfigService.setConfig(rechargeConfigValidate);
        return AjaxResult.success();
    }

}
